//
//  HJAskCell.m
//  Sneakers
//
//  Created by 胡光健 on 2017/10/27.
//  Copyright © 2017年 mac. All rights reserved.
//

#import "HJAskCell.h"
#import "HJMineModel.h"

@interface HJAskCell ()
@property (weak, nonatomic) IBOutlet UIImageView *shoesImage;
@property (weak, nonatomic) IBOutlet UILabel *shoesName;
@property (weak, nonatomic) IBOutlet UILabel *money;
@property (weak, nonatomic) IBOutlet UILabel *code;
@property (weak, nonatomic) IBOutlet UILabel *stauteTime;
@property (weak, nonatomic) IBOutlet UIImageView *colorImage;
@property (weak, nonatomic) IBOutlet UILabel *percent;
@property (weak, nonatomic) IBOutlet UIImageView *stauteImage;

@property (weak, nonatomic) IBOutlet UILabel *btmtime;
@property (weak, nonatomic) IBOutlet UIButton *zhifuBtn;
@end
@implementation HJAskCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.btmtime.font =HJFontSize(mScreenWidth/414 * 13);
    self.stauteTime.font =HJFontSize(mScreenWidth/414 * 13);
    self.code.font =HJFontSize(mScreenWidth/414 * 13);
    self.shoesName.font =HJFontSize(mScreenWidth/414 * 15);
    self.percent.font =HJFontSize(mScreenWidth/414 * 15);
    self.money.font =HJFontSize(mScreenWidth/414 * 19);
    self.zhifuBtn.layer.borderWidth = 0.5;
    self.zhifuBtn.layer.borderColor = HJColorRGB(51).CGColor;
    self.zhifuBtn.layer.cornerRadius = 16;
    self.zhifuBtn.layer.masksToBounds = YES;
    
}

-(void)setSellModel:(HJSellModel *)sellModel {
    _sellModel = sellModel;
    [self.shoesImage sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@/%@",sellModel.avatar_base_url,sellModel.avatar_path]]];
    self.shoesName.text = sellModel.shoes_name;
    self.code.text = [NSString stringWithFormat:@"%@码",sellModel.shoes_size];
    self.money.text = [NSString stringWithFormat:@"￥%@",sellModel.sell_money];
    self.stauteTime.text = sellModel.created_at;
//    请于2017/9/12 24:00前支付您的款项
    self.btmtime.text = sellModel.refund;
    
    if ([sellModel.created_at isEqualToString:@"已过期"]) {
        self.stauteTime.font = [UIFont fontWithName:@"PingFangSC-Semibold" size:13];
    }
    if ([sellModel.state2 isEqual:@0]) {
        self.percent.textColor = HJColor(255, 72, 74);
        self.colorImage.image = HJImage(@"Fill 7");
    }else {
        self.percent.textColor = HJColor(71, 201, 157);
        self.colorImage.image = HJImage(@"Fill 1 Copy 00");
    }
    
    if ([sellModel.percent isEqualToString:@"0.00"]) {
        self.percent.text = @"";
        self.colorImage.hidden = YES;
    }else {
        self.percent.text = [NSString stringWithFormat:@"%@%%",sellModel.percent];
    }
    
    if ([sellModel.is_false isEqual:@1]) {
        self.btmH.constant = 60.0;
    }else {
        self.btmH.constant = 0.0f;
        self.btmtime.hidden = YES;
        self.zhifuBtn.hidden = YES;
    }
    
}
- (IBAction)payBtn:(UIButton *)sender {
    
    [mNotificationCenter postNotificationName:@"PayBtnNotification" object:nil userInfo:@{@"percent":_sellModel.pay,@"order_sn":_sellModel.want_buy_id}];
    
}
@end
